package com.wisdytech.ccdserver.bucket.api.impl;

import com.wisdytech.ccdserver.bucket.api.IBucketMngService;
import com.wisdytech.ccdserver.bucket.dto.BucketTenDto;
import com.wisdytech.ccdserver.bucket.serveice.IBucketService;
import com.wisdytech.ccdserver.bucket.serveice.IBucketTaskService;
import com.wisdytech.ccdserver.common.dto.FileDto;
import com.wisdytech.common.bean.Filter;
import com.wisdytech.common.bean.MultiResultResponse;
import com.wisdytech.common.bean.UniqueResultResponse;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.InputStream;
import java.util.List;

@DubboService
public class BucketMngServiceImpl implements IBucketMngService {

    @Autowired
    private IBucketService bucketService;

    @Autowired
    private IBucketTaskService bucketTaskService;


    public UniqueResultResponse getBucketList(Filter filter) throws Exception {
        return bucketService.getBucketList(filter);

    }

    /**
     * @Description: 异常追溯界面下载CCD查询模版数据
     * @Param: * @param null
     * @return: * @return null
     * @Author: SV00216491
     * @Date: 2024/4/17  14:45
     */

    public UniqueResultResponse downloadCcdTemplate(Filter filter) throws Exception {
        return bucketService.downloadCcdTemplate(filter);
    }

    /**
     * @Description: 批量删除任务
     * @Param: * @param ids
     * @return: * @return com.wisdytech.common.bean.UniqueResultResponse
     * @Author: SV00216491
     */

    public UniqueResultResponse deleteBucketTaskByIds(Filter filter) {
        return bucketTaskService.deleteBucketTaskByIds(filter);
    }

    /**
     * @Description: 批量中止任务
     * @Param: * @param ids
     * @return: * @return com.wisdytech.common.bean.UniqueResultResponse
     * @Author: SV002164919
     */
    public UniqueResultResponse interruptBucketTaskByIds(Filter filter) {
        return bucketTaskService.interruptBucketTaskByIds(filter);
    }

    @Override
    public UniqueResultResponse getBucketListTen(Filter filter) throws Exception {
        return bucketService.getBucketListTen(filter);
    }

    @Override
    public UniqueResultResponse getBucketsByName(Filter filter) throws Exception {
        return bucketService.getBucketsByName(filter);
    }

    @Override
    public MultiResultResponse getBucketsByPage(Filter filter) throws Exception {
        return bucketService.getBucketsByPage(filter);
    }

    @Override
    public BucketTenDto getBucketsByPages(Filter filter) throws Exception {
        return bucketService.getBucketsByPages(filter);
    }

    @Override
    public UniqueResultResponse getDirectorys(Filter filter) throws Exception {
        return bucketService.getDirectorys(filter);
    }

    @Override
    public UniqueResultResponse getImageUrl(Filter filter) throws Exception {
        return bucketService.getImageUrl(filter);
    }

    @Override
    public InputStream getImage(Filter filter) throws Exception {
        return bucketService.getImage(filter);
    }

    @Override
    public UniqueResultResponse getImageResult(Filter filter) throws Exception {
        return bucketService.getImageResult(filter);
    }

    @Override
    public UniqueResultResponse manualOperationBucketTask(Filter filter) {
        return bucketService.manualOperationBucketTask(filter);
    }

    @Override
    public MultiResultResponse<FileDto> exportBucketsByPage(Filter filter, int rowLimit) throws Exception {
        return MultiResultResponse.success(bucketService.exportBucketsByPage(filter,rowLimit));
    }
}
